package com.example.microserviceprovidersample;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p> Demo  </p>
 *
 * @author Chris
 * @since 2022/11/15 16:47
 */
@RestController
@RequestMapping("/demo")
public class DemoController {

    @Value("${user.name:}")
    private String username;

    @Value("${user.age:0}")
    private Integer userAge;

    @GetMapping("/hello")
    public String sayHello(String name) {
        return "Hello, " + name;
    }

    @GetMapping("/user")
    public String getUser() {
        return username + " : " + userAge;
    }

}